package com.google.code.guava.base;

import com.google.common.base.Predicate;

/**
 * A base class for {@link Predicate Predicates} that enforces the presence of
 * the standard methods {@link #equals(Object)}, {@link #hashCode()} and
 * {@link #toString()}.
 * 
 * @author Sean Patrick Floyd
 * @param <T>
 */
public abstract class BasePredicate<T> implements Predicate<T>{

    @Override
    public abstract int hashCode();

    @Override
    public final boolean equals(final Object obj){
        return obj != null && obj instanceof Predicate
               && equalsPredicate((Predicate<?>) obj);
    }

    protected abstract boolean equalsPredicate(Predicate<?> other);

    @Override
    public abstract String toString();

}
